<link href="/static/public/layer/src/css/layui.css" rel="stylesheet">
<link href="/static/public/css/style.css" rel="stylesheet">
<script type="text/javascript" src="/static/manage/js/jquery-1.7.2.min.js"></script>
<script src="/static/public/layer/src/layui.js"></script>
<table class="layui-table" lay-even lay-skin="row">
    <thead>
        <tr>
            <th width="350">激活码</th>
            <th width="220">操作</th>
        </tr>
    </thead>   
    <tbody>
    <{foreach from=$codes item=item}>
        <tr>
            <td class="not_lb tal"><span class="c-ff6d5e"><{$item.code}></span></td>
            <td class="not_lb tal">
                <a class="layui-btn layui-btn-primary layui-btn-small send" href="javascript:;" url="/order_course_auth/send/<{$item.code}>/<{$data_type}>/<{$order_num}>">发放</a>
            </td>
        </tr>
    <{/foreach}>
    <{if $codes|count eq 0}>
        <tr>
            <td class="center" style=" height:120px; text-align:center;line-height:120px;" colspan="6">
                赞无数据！
            </td>
        </tr>
    <{/if}>
    <tr>
        <td class="center" colspan="12">
            <!-- <input type="checkbox" lay-filter="checkbox_all" title="全选">
            <button id="delete" class="layui-btn layui-btn-primary layui-btn-small" style="margin-top:4px;"><i class="layui-icon"></i> 批量删除</button> -->
        </td>
    </tr>
    </tbody>
</table>
<script>

    $(".send").click(function(){
        if(window.confirm('激活码发放后无法收回，您确定要发放此激活码吗？')){
            $.ajax({
                type: "GET",
                url: $(this).attr("url"),
                dataType:"json",
                success: function(result){
                    var index = parent.layer.getFrameIndex(window.name); //先得到当前iframe层的索引
                    parent.layer.close(index);
                    alert(result.msg);
                }
            });
        }
    })
</script>
